package util;

import java.sql.*;

import com.zmht.specedu.frame.bean.manage.SpringApplicationContextOwner;
import com.zmht.specedu.frame.util.ConnectionBuilder;

public class DBHelper {

    private static Connection conn = null;

    private DBHelper() {

    }

    public static Connection getConnection() {
	if (true) {
	   /* try {
		Class.forName("com.mysql.jdbc.Driver").newInstance();
		conn = DriverManager
			.getConnection(
				"jdbc:mysql://172.16.1.15:3306/specialschool?characterEncoding=GBK",
				"root", "123456");
	    } catch (IllegalAccessException iae) {
		iae.printStackTrace();
		return null;
	    } catch (InstantiationException ie) {
		ie.printStackTrace();
		return null;
	    } catch (ClassNotFoundException cnfe) {
		cnfe.printStackTrace();
		return null;
	    } catch (SQLException sqle) {
		sqle.printStackTrace();
		return null;
	    }*/
	    try {
		conn = ConnectionBuilder.buildConnection(SpringApplicationContextOwner.getInstance());
	    } catch (SQLException e) {
		e.printStackTrace();
	    }
	}

	return conn;
    }
}
